package com.europe.business.europebusiness.ui.activity;

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;

import com.europe.business.europebusiness.R;
import com.europe.business.europebusiness.ui.activity.base.ActionBarActivity;

public class SelectIdentityActivity extends ActionBarActivity implements View.OnClickListener {

    private LinearLayout chinaCompany;
    private LinearLayout chinaPerson;
    private LinearLayout europeCompany;
    private LinearLayout europeChinaCompany;
    public static final int SORT_CHINA = 4;
    public static final int SORT_CHINA_PERSON = 1;
    public static final int SORT_EUROPE = 3;
    public static final int SORT_EUROPE_CHINA = 2;

    @Override
    protected int setMainContent() {
        return R.layout.activity_select_identity;
    }

    @Override
    protected void initView() {
        super.initView();
        setToolbarNavigationIcon(R.drawable.actionbar_back);
        setActionRight(false, getString(R.string.register),null);
        setTitle(getString(R.string.title_select_auth));
        chinaCompany = findViewById(R.id.ch_company);
        chinaPerson = findViewById(R.id.ch_person);
        europeCompany = findViewById(R.id.eu_company);
        europeChinaCompany = findViewById(R.id.cn_company_eu);

        chinaCompany.setOnClickListener(this);
        chinaPerson.setOnClickListener(this);
        europeCompany.setOnClickListener(this);
        europeChinaCompany.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.ch_company:
                trans(SORT_CHINA);
                break;

            case R.id.ch_person:
                trans(SORT_CHINA_PERSON);
                break;

            case R.id.eu_company:
                trans(SORT_EUROPE);
                break;

            case R.id.cn_company_eu:
                trans(SORT_EUROPE_CHINA);
                break;
        }
    }
    private void trans(int index){
        Intent intent = new Intent(this, RegisteredActivity.class);
        intent.putExtra("sort", index);
        startAct(intent);
    }
}
